home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / gjr / cmplrtst.lha / string.scm < prev    next >
Encoding:
Text File  |  1993-01-27  |  701 b   |  34 lines

  1. ;;; -*- Scheme -*-
  2.  
  3. #|
  4.  
  5. Description:
  6.  
  7. This code tests string manipulation, including widening of characters 
  8. (not sign extension) to full words.
  9.  
  10. Usage:
  11.  
  12. (my-string-copy "foo") -> "foo"
  13. (my-string-copy "supercalifragilisticoexpialidoso") -> "supercalifragilisticoexpialidoso"
  14.  
  15. (test-meta-chars #\a) -> #\a
  16. (test-meta-chars #\M-f) -> #\M-f
  17.  
  18. |#
  19.  
  20. (declare (usual-integrations))
  21.  
  22. ;; This tests general string
  23.  
  24. (define (my-string-copy s)
  25.   (let* ((l (string-length s))
  26.      (new (make-string l)))
  27.     (do ((i 0 (fix:+ 1 i)))
  28.     ((fix:= i l) new)
  29.       (string-set! new i (string-ref s i)))))
  30.  
  31. (define (test-meta-chars c)
  32.   (let ((string (make-string 4)))
  33.     (string-set! string 0 c)
  34.     (string-ref string 0)))